package com.wumeng.interview.view;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;

import com.wumeng.interview.R;
import com.wumeng.interview.adapter.FirstRecyclerAdapter;
import com.wumeng.interview.bean.RecordBean;

import java.util.ArrayList;
import java.util.List;

/**
  * @Time : 2021/8/7
  * @Author : Wu-Meng
  * @Description :
 */
public class DoubleRecyclerActivity extends AppCompatActivity {

    private RecyclerView mRecyclerView;

    private List<List<RecordBean>> recordBeanListList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_double_recycler);
        initView();
    }

    /**
     * 初始化View
     */
    private void initView() {
        mRecyclerView = findViewById(R.id.first_recycler);
    }

    @Override
    protected void onStart() {
        super.onStart();
        initRecycler();
        initData();

        mRecyclerView.setAdapter(new FirstRecyclerAdapter(this,recordBeanListList));
    }

    /**
     * 初始化RecyclerView
     */
    private void initRecycler() {
        LinearLayoutManager manager = new LinearLayoutManager(this);
        manager.setOrientation(LinearLayoutManager.VERTICAL);
        mRecyclerView.setLayoutManager(manager);
    }

    /**
     * 初始化数据
     */
    private void initData() {
        recordBeanListList = new ArrayList<>();
        for (int i = 0; i < 30; i++) {
            List<RecordBean> recordBeanList = new ArrayList<>();
            for (int j = 0; j < 10; j++) {
                RecordBean bean = new RecordBean("w" + j);
                recordBeanList.add(bean);
            }
            recordBeanListList.add(recordBeanList);
        }
    }


}